/**
 * 
 */
package com.yidu.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.apache.log4j.Logger;
import org.springframework.stereotype.Service;

import com.yidu.bean.OrdIncome;
import com.yidu.bean.TbShop;
import com.yidu.bean.TbShopExample;
import com.yidu.dao.TbOrderMapper;
import com.yidu.dao.TbShopMapper;
import com.yidu.message.Pages;
import com.yidu.service.TbShopService;

/**
 * 
 * @author liutao
 * @data 2018年7月16日
 * @version 1.0
 */
@Service
public class TbShopServiceImpl implements TbShopService{

	Logger logger = Logger.getLogger(TbShopServiceImpl.class);
	
	@Resource
	private TbShopMapper tbShopDao ;

	@Resource
	private TbOrderMapper tbOrderDao ;
	
	@Override
	public int delete(String shopId) {
		logger.info("进入删除方法...");
		int num  = tbShopDao.deleteByPrimaryKey(shopId);
		return num;
	}

	@Override
	public int save(TbShop shop) {
		logger.info("进入增加方法...");
		int num  = tbShopDao.insertSelective(shop);
		return num;
	}

	@Override
	public int update(TbShop shop) {
		logger.info("进入修改方法...");
		int num  = tbShopDao.updateByPrimaryKey(shop);
		return num;
	}

	@Override
	public List<TbShop> findVague(Pages page, TbShop shop) {
		logger.info("findVague::"+shop.getTypeId());
		List<TbShop> list = tbShopDao.findVague(page, shop);
		
		return list;
	}
	
	@Override
	public List<TbShop> selectByExample(TbShopExample example) {
		List<TbShop> list = tbShopDao.selectByExample(example);
		
		return list;
	}
	
	@Override
	public TbShop findById(String ShopId) {
		logger.info("进来到店面的service...");
		return tbShopDao.selectByPrimaryKey(ShopId);
		
	}

	@Override
	public List<TbShop> findAll() {
		return tbShopDao.findAll();
	}

	@Override
	public int findCount(TbShop shop) {
		return 0;
	}

	@Override
	public List<TbShop> findVagues(Pages page, TbShop shop) { 
		logger.info("进入左连接查询..");
		List<TbShop> list = tbShopDao.findMod(page, shop);
		return list;
	}

	@Override
	public int findCounts(TbShop shop) {
		 logger.info("查询结果集...");
		 Long lon = tbShopDao.findCounts(shop);
		 int num = lon.intValue();
		return num;
	}

	@Override
	public List<OrdIncome> salesOfShop(String year, String id) {
		List<OrdIncome> list = tbOrderDao.salesOfShop(year, id);
		return list;
	}

	@Override
	public int isvaUp(TbShop shop) {
		logger.info("审核..");
		int num = tbShopDao.update(shop);
		return num;
	}

}
